//Use JAVA ID3 to get information, such as film title, to generate XML
//Make this recursive to find content in all subdirectories
//Grab content from start directory
package Andrew;

import java.io.File;
import java.io.FileFilter;
import java.io.FilenameFilter;

public class FileTest {
	public static String[] files() {
		final File dir = new File("C:/Documents and Settings/Andrew/Dist");
		String filename = "";
		String[] children = null;

		final FileFilter fileFilter = new FileFilter() {
			@Override
			public boolean accept(final File file) {
				return file.isDirectory();
			}
		};
		final File[] files = dir.listFiles(fileFilter);

		for (int i = 0; i < files.length; i++) {
			final FilenameFilter filter = new FilenameFilter() {
				@Override
				public boolean accept(final File dir, final String name) {
					final String regex = "^.*\\.(avi|mp4|mkv|vob|mov|mp2m4a)$";
					;
					return name.matches(regex);
				}
			};
			children = files[i].list(filter);
			if (children == null) {
				// Either dir does not exist or is not a directory
				System.out.println("Directory no found");
			} else {
				for (int j = 0; j < children.length; j++) {
					// Get filename of file or directory
					filename += children[j] + "\n";
				}
			}
		}
		// It is also possible to filter the list of returned files.
		// This example does not return any files that start with `.'.
		return children;
	}
}
